<div align="center">
  <DIV class=boxright>
    <DIV class=bltop2>
      <div align="left">
        <strong>&nbsp;&nbsp;&nbsp;当前位置：&nbsp;&nbsp;
          <%=link_to "资料查询", :action=>"search"%>
        </strong>
      </div>
    </DIV>
    <DIV class=c_box>
      <DIV class="rep_left">

        <form name="form1" action="/resource/search_by_key" method="post">
          <TABLE id=tblSearch  cellSpacing=0 cellPadding=4 width="100%" border=0>
            <input type="hidden" name="authenticity_token" value="<%=form_authenticity_token%>"> 
            <TBODY>
              <TR>
                <TD class=rtdp height=22 width="30%" ALIGN="left"><STRONG>搜索资料</STRONG></TD>              
                <TD class=rtdp align="right" COLSPAN="2"><%= text_field "mediafile","cryped_filename",:class=>"text", :style=>"WIDTH: 330px"%></TD>
                <TD class=rtdp width="48%" ALIGN="left">
                  <a href="#" onclick="funConfirm();">
                    <img alt="搜索" src="/images/search.png" width="28" height="25" border="0">
                  </a>
                </TD>
              </TR>
            </TBODY>
          </TABLE>
        </form>
        
        <% form_tag :action => 'search_by_conditions'do %>
          <TABLE cellSpacing=0 cellPadding=4  width="100%" border=0>
            <TBODY>
              <TR>
                <TD class=rtdp height=22 COLSPAN="4" ALIGN="left"><STRONG>查询资料</STRONG></TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 width="15%" ALIGN="left">
                  &nbsp;
                </TD>
                <TD class=rep_li_c2 width="10%" align="left">          
                  <%=@resources=Resource.find :all ,:conditions=>"resource_level=2"
                  @resources<<Resource.new(:id=>0,:resource_name=>"全部")
                  @resources<<Resource.new(:id=>0,:resource_name=>"--企业品牌--")
                  collection_select(:mediafile,"resource_id",@resources,:id,:resource_name,{},:style=>"WIDTH: 150px")								
                %>	
                </TD>
                &nbsp;
                <TD class=rep_li_c2 width="10%" align="left">          
                  <%=@dictionaries=Dictionary.find :all ,:conditions=>"CON_TYPE='prefix_two'"  
                  @dictionaries<<Dictionary.new(:id=>0,:content=>"全部")
                  @dictionaries<<Dictionary.new(:id=>0,:content=>"--宣传类型--")
                  collection_select(:mediafile,"prefix_two",@dictionaries,:id,:content,{},:style=>"WIDTH: 150px")								
                %>		
                </TD>
                <TD class=rep_li_c2 width="10%" ALIGN="left">
                  &nbsp;
                </TD>
              
              </TR>
              <TR>
                <TD class=rep_li_c2 width="10%"></TD>
                <TD class=rep_li_c2 width="18%" ALIGN="left"> 
                  <%=@dictionaries=Dictionary.find :all ,:conditions=>"CON_TYPE='city'"
                  @dictionaries<<Dictionary.new(:id=>0,:content=>"--适用区域--")
                  collection_select(:mediafile,"prefix_three",@dictionaries,:id,:content,{},:style=>"WIDTH: 150px")								
                %>	
                </TD>
                <TD class=rep_li_c2 width="18%" ALIGN="left"> 
                  <%=@mediafiles=Mediafile.find :all ,:conditions=>"1>2"
                  @mediafiles<<Mediafile.new(:created_at=>(1.weeks.ago).to_date,:title=>"1周以内")
                  @mediafiles<<Mediafile.new(:created_at=>1.months.ago.to_date,:title=>"1个月以内")
                  @mediafiles<<Mediafile.new(:created_at=>3.months.ago.to_date,:title=>"3个月以内")
                  @mediafiles<<Mediafile.new(:created_at=>6.months.ago.to_date,:title=>"6个月以内")
                  @mediafiles<<Mediafile.new(:created_at=>1.years.ago.to_date,:title=>"1年以内")
                  @mediafiles<<Mediafile.new(:created_at=>2.years.ago.to_date,:title=>"2年以内")
                  collection_select(:mediafile,"created_at",@mediafiles,:created_at,:title,{},:style=>"WIDTH: 150px")								
                %>	
                </TD>
                <TD class=rep_li_c2 width="18%">&nbsp;</TD>              
              </TR>
              <TR>
                <TD class=rep_li_c2 colSpan=2 ALIGN="right">
                  <INPUT onMouseOver="this.className='submit2'" onMouseOut="this.className='submit'" class=submit id="" type=submit value="搜索" name="">
                
                </TD>
                <TD class=rep_li_c2 colSpan=2></TD>
              </TR>
            </TBODY>
          </TABLE>
        <%end%>
        <%form_tag :action=>"operation" do%>
          <TABLE class=tatop7px cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR>
                <TD class=rtdw width="4%">
                <INPUT id="chkAll" onclick="title_check('chkAll', 'chkID[]')"  type=checkbox value=checkbox></TD>
                 <TD class=rep_li_c width="10%"><STRONG>一级目录</STRONG></TD>  
                <TD class=rep_li_c width="10%"><STRONG>二级目录</STRONG></TD>
                <TD class=rep_li_c width="25%"><STRONG>文件名</STRONG></TD>  
                <TD class=rep_li_c width="8%"><STRONG>上传人</STRONG></TD>
                <TD class=rep_li_c width="8%"><STRONG>大小</STRONG></TD>
                <TD class=rep_li_c width="15%"><STRONG>创建日期</STRONG></TD>
                <TD class=rep_li_c width="5%"><STRONG>&nbsp;</STRONG></TD>              
              </TR>
              <%for file in @files%>
                <TR id="tr_<%=file.id%>" style="TEXT-DECORATION: none" onMouseOver="this.style.backgroundColor='#EFF8FF'" onmouseout="this.style.backgroundColor=''">
                  <TD class=rtdw2>
                  <INPUT onclick="rows_check('chkAll', 'chkID[]')" type=checkbox value="<%=file.id%>" name="chkID[]"></TD>
                  <TD class=rep_li_td_bt ALIGN="left" ><%=file.resource.fatherRes.resource_name%></TD>
                  <TD class=rep_li_td_bt ALIGN="left" ><%=file.resource.resource_name%></TD>
                  <TD class=rep_li_td_bt ALIGN="left" >
                    <%=file.cryped_filename%>
                  </TD>        
                  <TD class=rep_li_td_bt><%=file.creater.login_name%></TD>
                  <TD class=rep_li_td_bt><%=trunc_size(file.file_size)%>(M)</TD>
                  <TD class=rep_li_td_bt><%=file.created_at.to_s(:db)%></TD>
                  <TD class=rep_li_td_bt>
                  	  <a href="<%=$down_load_path%>/<%=trunc_path(file.file_path)%>" target="_blank">下载</a>
                  </TD>
                </TR>
              <%end%>
            </TBODY>
          </TABLE>
        
          <TABLE class=tatop7px cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR>
                <TD  align="center">
                  <%=will_paginate @files%>
                </TD>
              </TR>
            </TBODY>
          </TABLE>
          <TABLE cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR vAlign=top>
              <TR vAlign=top ALIGN="left">
                <TD>
                  <INPUT onclick="return check_select_one('chkAll', 'chkID[]')"
                         name="button" class="button" id="edit"  type="submit" value="编辑文件">
                  <INPUT onclick="return check_select('chkID[]')"
                         name="button" class="button" id="delete"  type="submit" value="放入回收站">
                  <INPUT onclick="return check_select('chkID[]')"
                         name="button" class=button id="destroy"  type="submit" value="彻底删除">
                </TD>
              </TR>
            </TBODY>
          </TABLE>
        <%end%>
                                                                                                
      </DIV>
    </DIV>
    <SCRIPT type="text/javascript">
        iniControlsEvent(document.forms[0]);
        function showSearching(){
            $("tblSearch").style.display="";
        }
        function hideSearching(){
            $("reset").click();
            $("tblSearch").style.display="none";
        }
        
        function funConfirm(){
            if($F("mediafile[cryped_filename]")==""){ 
                alert("请输入关键字!");
                $("mediafile_cryped_filename").focus(); 
                return false; 
            }
            else {
                $("form1").submit(); return true;
            }                        
        }
    </SCRIPT>
  </DIV>
  <div>
  </div>
</div>

